package com.study.service.impl;

import com.study.service.MsgService;
import org.springframework.stereotype.Service;

import java.util.HashMap;

/**
 * @desc:
 * @author: panxiyi
 * @date: 2023/5/3 10:07 下午
 */

@Service
public class MsgServiceImpl implements MsgService {

    HashMap<String, String> teleMapCode = new HashMap<>();

    @Override
    public String genCode(String tele) {
        String code = tele.substring(tele.length() - 4);
        teleMapCode.put(tele, code);
        return code;
    }

    @Override
    public Boolean checkCode(String tele, String code) {
        return teleMapCode.get(tele).equals(code);
    }
}
